home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1997 August / Walnut Creek CDROM.7z / VOL_400 / 446_01 / DOC / FDMSTART / EX6 / CONSLAW.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-18  |  1.2 KB  |  43 lines

  1. #ifndef ConsLaw_h_IS_INCLUDED
  2. #define ConsLaw_h_IS_INCLUDED
  3. #include <FieldFD.h>
  4. #include <TimePrm.h>
  5. #include <FieldFunc.h>
  6. #include <schemes.h>    // for size of Handle(HCLSchemes)
  7.  
  8. // initial condition (function body in ConsLaw.C):
  9. extern real start1 (const Ptv(real)& x, real t = DUMMY);
  10. // flux function (function body in ConsLaw.C):
  11. extern real linearFlux (real u);
  12. typedef real (*Flux)(real u);  // flux function pointer
  13.  
  14. class ConsLaw
  15. {
  16. public:
  17.   Handle(GridLattice) grid;       // lattice grid (here: 1D grid)
  18.   Handle(FieldFD) u;              // solution at time step n+1
  19.   Handle(FieldFD) u_prev;         // solution at time step n
  20.   TimePrm tip;                    // time integration parameters (delta t etc.)
  21.   SetOfNo(real) time_points_for_plot; // time points for making plots
  22.   Flux f;                         // flux function, Flux is a function ptr
  23.   CurvPlotFile file;              // for plotting results
  24.   String scheme_tp;               // (class) name of scheme
  25.   Handle(HCLSchemes) scheme;      // numerical scheme (functor)
  26.  
  27.   ConsLaw () {}
  28.  ~ConsLaw () {}
  29.  
  30.   void scan (Is is);
  31.   void solveProblem ();
  32. protected:
  33.   void setIC ();
  34.   void timeLoop ();
  35.   void solveAtThisTimeLevel ();
  36.   void saveResults ();
  37.   void updateDataStructures ();
  38. };
  39. #endif
  40.  
  41.  
  42.  
  43.